<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>3.修改节点</title>
    <style>
        .h{
            color: red;
        }
    </style>
</head>
<body>
        <div class="box">段落1<span>内容</span></div>
        <div class="box">
            11111
        </div>
        <div class="box">段落3</div>
</body>
<script>
    var box0=document.getElementsByClassName('box')[0]
    var box1=document.getElementsByClassName('box')[1]
    var box2=document.getElementsByClassName('box')[2]
    console.log(box0)
    console.log(box1)
    console.log(box2)//按上下文顺序获取，不论层

    //获取对象的文本  里面的所用内容包括<>内的代码
    console.log(box0.innerHTML)
    console.log(box1.innerHTML)
    //给body里面的补充代码内容   内外双引号单引号交换使用
    box1.innerHTML='段落1<span>段落1的span</span></br><h1 class="h">标题</>'
    //更改网页显示的内容
    box2.innerText='修改后的innertText'
    console.log(box2.innerText)
</script>
</html>